var t,
  n = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  a = getApp();
Page({
  data: { mask_class: "alpha0_100" },
  onLoad: function (t) {
    var n = this;
    this.setData({ id: t.id }),
      a.get_config("_ZEAI").then(function (t) {
        n.setData({ color: a._ZEAI.color, rgbcolor: i.c16_rgb(a._ZEAI.color) });
      }),
      a.get_navigationBarTopHeight(this),
      a.get_openid().then(function (t) {
        n.init();
      });
  },
  init: function () {
    var n = this;
    i.ifint(this.data.id) ||
      wx.showModal({
        content: "参数跑路了",
        confirmColor: n.data.color,
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (t) {
          wx.navigateBack();
        },
      }),
      wx.showLoading({ title: "玩命加载中...", mask: !0 }),
      (t = wx.getStorageSync("COOK_U")),
      a.ajax({
        url: "qun.php",
        data: { submitok: "qun_detail", openid: t.openid, id: n.data.id },
        success: function (t) {
          if (1 == t.flag) {
            t.D.plist;
            var a = i.escape2Html(t.D.content);
            n.setData({
              D: t.D,
              ULIST: t.ULIST,
              TJ: t.TJ,
              content: a,
              FL: t.FL,
              BTN: t.BTN,
              SHARE: t.SHARE,
              ios_ifpay: t.ios_ifpay,
            });
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          wx.hideLoading();
        },
      });
  },
  BTNfn: function () {
    1 != this.data.BTN.iflogin
      ? wx.navigateTo({ url: "../login/login" })
      : 1 == this.data.BTN.ifed
      ? wx.navigateTo({ url: "qun_trend?qid=" + this.data.id })
      : this.qun_add();
  },
  qun_add: function () {
    var n = this;
    a.ajax({
      url: "qun.php",
      data: { submitok: "joinqun", openid: t.openid, id: n.data.id },
      success: function (o) {
        1 == o.flag
          ? n.init()
          : "pay" == o.flag
          ? wx.showModal({
              title: "您确定要加入此群么？",
              content:
                "如果同意加入该单身群\n需要支付￥" +
                o.money +
                "元\n（支付后将不退还）",
              confirmColor: n.data.color,
              cancelText: "我再想想",
              confirmText: "确定加群",
              success: function (o) {
                o.confirm &&
                  (1 != n.data.ios_ifpay.flag
                    ? wx.getSystemInfo({
                        success: function (o) {
                          "ios" == o.platform
                            ? wx.showModal({
                                title: "温馨提示",
                                content: n.data.ios_ifpay.tips,
                                confirmColor: n.data.color,
                                cancelText: "返回",
                                confirmText: "联系服务人员",
                                success: function (t) {
                                  t.confirm
                                    ? wx.redirectTo({ url: "../my/hongniang" })
                                    : t.cancel && wx.navigateBack();
                                },
                              })
                            : a.pay({
                                data: {
                                  submitok: "qun_add",
                                  openid: t.openid,
                                  id: n.data.id,
                                },
                                success: function () {
                                  wx.showModal({
                                    title: "加入成功！",
                                    content:
                                      "恭喜您成为本群中的一员，您可以与群友一起交流邂逅啦~~~",
                                    confirmColor: n.data.color,
                                    confirmText: "朕知道了",
                                    showCancel: !1,
                                    success: function (t) {
                                      n.init();
                                    },
                                  });
                                },
                                fail: function (t) {
                                  (t.this = n), (t.url = "no"), i.sorry(t);
                                },
                              });
                        },
                      })
                    : a.pay({
                        data: {
                          submitok: "qun_add",
                          openid: t.openid,
                          id: n.data.id,
                        },
                        success: function () {
                          wx.showModal({
                            title: "加入成功！",
                            content:
                              "恭喜您成为本群中的一员，您可以与群友一起交流邂逅啦~~~",
                            confirmColor: n.data.color,
                            confirmText: "朕知道了",
                            showCancel: !1,
                            success: function (t) {
                              n.init();
                            },
                          });
                        },
                        fail: function (t) {
                          (t.this = n), (t.url = "no"), i.sorry(t);
                        },
                      }));
              },
            })
          : ((o.this = n), (o.url = "no"), i.sorry(o));
      },
    });
  },
  vipFn: function () {
    a.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  certFn: function () {
    a.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my/cert" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  dataFn: function () {
    a.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../reg/reg" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  mask_closeFn: function (t) {
    var i = this,
      a = t.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        var t;
        i.setData((n((t = {}), a, !1), n(t, "mask_class", "alpha0_100"), t));
      }, 500);
  },
  qun_ulistFn: function () {
    1 != this.data.BTN.iflogin
      ? wx.navigateTo({ url: "../login/login" })
      : wx.navigateTo({ url: "qun_ulist?qid=" + this.data.id });
  },
  getPhoneNumber: function (t) {
    this.init(),
      a.getPhoneNumber({ e: t, url: "../my/my", urlkind: "switchTab" });
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  onPageScroll: function (t) {
    t.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (t) {
    wx.pageScrollTo({ scrollTop: 0, duration: 300 });
  },
  zxFn: function () {
    wx.pageScrollTo({ scrollTop: 999999, duration: 300 });
  },
  telFn: function (t) {
    wx.makePhoneCall({ phoneNumber: this.data.D.kf_tel });
  },
  mobFn: function (t) {
    wx.makePhoneCall({ phoneNumber: this.data.D.kf_mob });
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/qun/qun_detail?id=" + this.data.id,
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "id=" + this.data.id,
      path: "/pages/qun/qun_detail",
    };
  },
  ifagreeFn: function (t) {
    1 == t.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
});
